import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const data = {
   state:{
       componentData:[],
       editor:null
   },
   mutations:{
    addComponent(state,{component,index}){
        if(index !== undefined){
            state.componentData.splice(index,0,component)
        }else{
            state.componentData.push(component)
        }
    },
    getEditor(state){
        state.editor = document.getElementById('editor')
    }
   }
}
export default new Vuex.Store(data)